feat: vendor native DeepSeek Web XML tool-call normalizer#25
Open
RC-ia wants to merge 2 commits into
Open
Conversation
…seToolCall gap) DeepSeek Web emits native function calls as XML: <tool_call name="x"><parameter name="p">...</parameter></tool_call> The original parseToolCall() expected a JSON body and dropped these as plain text. Adds toolcall_normalizer.js as a FAST-PATH inside parseToolCall() that parses the native shape (plus strict/fenced JSON and legacy TOOL_CALL:) into clean OpenAI tool_calls. Zero new npm deps. - toolcall_normalizer.js: deterministic multi-shape parser (companion of RC-ia/deepseek-toolcall-normalizer) - server.js: require normalizer + pre-pass in parseToolCall(); export parseToolCall - tests/unit.test.js: +3 tests (native XML, plain text null, multi-param) - README:adds a Tool-call normalization patch section (credits ForgetMeAI upstream + companion normalizer) All 12 unit tests pass (9 original + 3 new). Credits to ForgetMeAI (t.me/forgetmeai).
…l-normalizer # Conflicts: # tests/unit.test.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DeepSeek Web emits native function calls as XML:
<tool_call name="todo_write">
[{"id":"1","content":"...","status":"in_progress"}]
</tool_call>
The current parseToolCall() expected a JSON body inside the tag and silently dropped these as plain text. This PR vendors a deterministic normalizer (toolcall_normalizer.js) that runs as a FAST-PATH inside parseToolCall() and converts the native shape (plus strict-JSON / fenced-JSON / legacy TOOL_CALL: variants) into a clean OpenAI tool_calls payload.
Changes
Test plan
npm test
All 12 unit tests pass (9 original + 3 new). Sample log line on a native call:
[parseToolCall] SUCCESS normalized (native/companion): todo_write
Notes
Generated with Hermes Agent (https://hermes-agent.nousresearch.com)